package com.example.io;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ZhangLiang
 * @Date: 2021/07/01/14:52
 * @Description:
 */
public class 键盘输入 {

    public static void main(String[] args) {
        /**方式一
        System.out.println("请输入:");
        Scanner in=new Scanner(System.in);
        String s=in.nextLine();
        in.close();
        System.out.println("输入数据:"+s);
         **/
        System.out.println("请输入:");
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        try {
            String s=in.readLine();
            in.close();
            System.out.println("输入数据:"+s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
